UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ry4hYtmzQWZlgZNhJkGhYssLAWUu8ItfGJ7+IsCNmxw=' 
WHERE 
  key_id = '33c5e1ee2b809d69738c72b439be08683238ee476ec201710240a5577cbe0339' 
  AND (
    token = 'ry4hYtmzQWZlgZNhJkGhYssLAWUu8ItfGJ7+IsCNmxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036