UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uJjYZOxviXZd0S8/7p1fvvho48pCMnKZt0jLvvWR6mQ=' 
WHERE 
  key_id = '4be381bbaaa5857bd2eed9bab74fb07cf7d648459e314ca391f60cb828a5c9ad' 
  AND (
    token = 'uJjYZOxviXZd0S8/7p1fvvho48pCMnKZt0jLvvWR6mQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026