UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hASdQmZzg7tVmKjpaHdlLR8An0hLpSWEJJMONp7EMjc='
WHERE
key_id = '0507e829020290b5a0495bd65225e2924a89ac61194f5478846d07b01615d0f0'
AND (
token = 'hASdQmZzg7tVmKjpaHdlLR8An0hLpSWEJJMONp7EMjc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)