UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8/0mWP01+kYfHOxWZIATHJlMAKmzDNUERbPCaJTqaDM='
WHERE
key_id = 'aebd24af89430e5de6b4eb4cdfd6677cb25d819204a32328a5e0bceb897511ed'
AND (
token = '8/0mWP01+kYfHOxWZIATHJlMAKmzDNUERbPCaJTqaDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)