UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ehNvg2qIJcXvMYpB0bvSCpYrZGPsTNNykB8g68AjvGs=' 
WHERE 
  key_id = '78cef1a8c0ac686f35492e68510fe8785d316dda3c23656bb1b49e5a9aa21bc0' 
  AND (
    token = 'ehNvg2qIJcXvMYpB0bvSCpYrZGPsTNNykB8g68AjvGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048