UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NcFzLLKr0gt9KkdVXVPY6JV/w+9ix8v7zZQFW7490/g='
WHERE
key_id = 'e8b14b93b45d4b6d8a036573857bd6588b1e0885f7f2cb8adadfe7a55ade5c7a'
AND (
token = 'NcFzLLKr0gt9KkdVXVPY6JV/w+9ix8v7zZQFW7490/g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)