UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yuYQrOy7YGwoEj/5K26bx9FsZ/+OBbtLDKBcZaXhcYE=' 
WHERE 
  key_id = '661369989efb54f5569ff807aa8d15e9256c06351b143c4e825aae8b74d4bf9f' 
  AND (
    token = 'yuYQrOy7YGwoEj/5K26bx9FsZ/+OBbtLDKBcZaXhcYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025