UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XB7lfPE3RDEosMxOqRWYb1iz6XXIIEBVgaDC7m5c06I='
WHERE
key_id = '0b996948fc392d6e5de1c616864a36155235c1a89174901af3f71a900de66230'
AND (
token = 'XB7lfPE3RDEosMxOqRWYb1iz6XXIIEBVgaDC7m5c06I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)