UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8HesAbWW9r+p451oEYhUypcfotzNrZV2SKQrXd+mhEU=' 
WHERE 
  key_id = '3c50f76a0cd72de4d4a75e406d74bed7e549ac2dff2298803659d62aeecce641' 
  AND (
    token = '8HesAbWW9r+p451oEYhUypcfotzNrZV2SKQrXd+mhEU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031