UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2toB3ofKYY6zyV5LOpPEbChX4oD7qlA4i6wrScH+0uE='
WHERE
key_id = '3c8f820aba7818e6e6405405d19caa87b282a93f5a2236a952d52e6ce2cd9f31'
AND (
token = '2toB3ofKYY6zyV5LOpPEbChX4oD7qlA4i6wrScH+0uE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)