UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MnYUYgxbygcKpwyOHd/QhKTo27ycAmfgAdeb4S3I6sg='
WHERE
key_id = 'cd0ba064151d7d7593cfde2d05dbede8fb123e04e281e6e137af551b4fc459c5'
AND (
token = 'MnYUYgxbygcKpwyOHd/QhKTo27ycAmfgAdeb4S3I6sg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)