UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z0hLYMtpvRjbWs2AobeMu7b+4iKOQYvpAeIa8hFrutY=' 
WHERE 
  key_id = '19c3d7a35194ffd4890279acd24d2feda84f2bf7b4cd9cb0daf42d1ba471dd21' 
  AND (
    token = 'Z0hLYMtpvRjbWs2AobeMu7b+4iKOQYvpAeIa8hFrutY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018