UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '67jHdGAPULLDqDY8gLCuwG8sbZez3uUKrhFA7cJ7Vxo='
WHERE
key_id = 'be97c3d0f5b2a10b86efb9f0d1b16121e4a981f5b8233f5a218ff06cea7e66d9'
AND (
token = '67jHdGAPULLDqDY8gLCuwG8sbZez3uUKrhFA7cJ7Vxo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)