UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ie3J5yFsyBFooIUtGUkT23ZfYFAXjht3uPYmhfUvHFM='
WHERE
key_id = 'f7d251bd1c7b3cc910acf64f1ca6fe9ec545c3930bb9d4fcd41b00c0d7ec7936'
AND (
token = 'ie3J5yFsyBFooIUtGUkT23ZfYFAXjht3uPYmhfUvHFM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)