UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQ7VKK8Kc85J/0qtJOPhMaeM6bQAGMhfTSKg6DBNzZY=' 
WHERE 
  key_id = 'b324a918fd4d06dd0018236ce788a7f844a588835c99ebd6c9bef9fc58106046' 
  AND (
    token = 'lQ7VKK8Kc85J/0qtJOPhMaeM6bQAGMhfTSKg6DBNzZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047