UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QukjT8O+pVXmq3PU91gO4ryXrpa7ZLlkl1eD2H47+hs='
WHERE
key_id = 'b5d1b10056669169440d0d98ae51c19aad90e18bdb2fe7a84571dfb9291405cf'
AND (
token = 'QukjT8O+pVXmq3PU91gO4ryXrpa7ZLlkl1eD2H47+hs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)