UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r9OOtazt8w58yxLlVGlzqV7+5GhqWhJxPx5/MlPNklE='
WHERE
key_id = 'ed24fe90497d7fdd1af3a0584a322e5f602e8c6131979d75fa394a8d5a26ea1d'
AND (
token = 'r9OOtazt8w58yxLlVGlzqV7+5GhqWhJxPx5/MlPNklE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)