UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bf9wgT3pLZOyyaWxvowLwmQCmZ1bnWWzIAKs+IBrtGk='
WHERE
key_id = 'a6f3aba7f2e8c1db3a982a4dbcb4483915105b9e3fd9f4fef1d83d89d465b2ff'
AND (
token = 'bf9wgT3pLZOyyaWxvowLwmQCmZ1bnWWzIAKs+IBrtGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)