UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kXg0P139ltuAYtQdaUbw/xQyuu3MaGGideJQ6afjPSU=' 
WHERE 
  key_id = 'a65f2196df82c1137f84251412edd4e6ed344c53452bc4dbf3ffa726854e6275' 
  AND (
    token = 'kXg0P139ltuAYtQdaUbw/xQyuu3MaGGideJQ6afjPSU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017