UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JrTB8mJIuR3txYl2WNJwEh+XHovRA6IfmusJljETrV8=' 
WHERE 
  key_id = '5f8d7842c94a2be2bcc9c0dff611553f457e706b2fe72978e992108be524b089' 
  AND (
    token = 'JrTB8mJIuR3txYl2WNJwEh+XHovRA6IfmusJljETrV8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012