UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cedD6Zdd77Ve9BZQw26P0LkvZtPproL3rXIZKb0BFrg='
WHERE
key_id = '669ff0041f84fb1ab77fa4f320f5071ba6dd34952458e145f9eae05e7b2a0893'
AND (
token = 'cedD6Zdd77Ve9BZQw26P0LkvZtPproL3rXIZKb0BFrg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)