UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r2SVu6eWxL/9oYG/rKEEn4cMUTN2vzu04OJkuX1cq0g=' 
WHERE 
  key_id = '2540f0bee9862b88cd3298171925c86100a913bb817ca1a69f003cad62058751' 
  AND (
    token = 'r2SVu6eWxL/9oYG/rKEEn4cMUTN2vzu04OJkuX1cq0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050