UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GyZCaxYJbYG4oh1msSo/dX+MoGGcR+jt5CuOnlwrf8c='
WHERE
key_id = 'c66bb8cb1817e347a0e2c12473019701c24e2a3199adfecf176ce157836cb671'
AND (
token = 'GyZCaxYJbYG4oh1msSo/dX+MoGGcR+jt5CuOnlwrf8c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)