UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XEw0z3Bu2ZUCEllDUZAoF9k3vluKarnXtpWerH0EUzE=' 
WHERE 
  key_id = '7da924db24d9984b862073ac56f1a34a9468c6b3fabc0a79d57f90d8b10f1f61' 
  AND (
    token = 'XEw0z3Bu2ZUCEllDUZAoF9k3vluKarnXtpWerH0EUzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034