UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6I6C97ghJ1i8mEyEI2e1RcqRotGZ2CJW6MoB23kjRq4='
WHERE
key_id = '7e90bd3711bfd65c09fb214c10942131e4b090b01a1b95304a1969effa3bd638'
AND (
token = '6I6C97ghJ1i8mEyEI2e1RcqRotGZ2CJW6MoB23kjRq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)