UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1QwoUGezXOrAvp/bTYAPLBGW5o8U4GSg7gN+1PDGQOo='
WHERE
key_id = 'cbf74cc8edf8ea64e868e8575f0f0e2602a0ee1f462e0a368ba0c3b0e835611b'
AND (
token = '1QwoUGezXOrAvp/bTYAPLBGW5o8U4GSg7gN+1PDGQOo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)