UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qh8z1Lo33TTbEQeWzgG7oA5fRaeHSSZaYeO779JgIxQ='
WHERE
key_id = '0e4e3e5cbd3da75d6eab464790eab860eb95666bbf53246b68b2733f8a77d9ec'
AND (
token = 'qh8z1Lo33TTbEQeWzgG7oA5fRaeHSSZaYeO779JgIxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)