UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5VSIS0MsEAwJ6vsHaN8Q4llZInllJiEclmQqUUUxPjE='
WHERE
key_id = '9d289dcbaeb4f85814aa1288fb94b6cd6438375813e2767889e6f8b9305dcb76'
AND (
token = '5VSIS0MsEAwJ6vsHaN8Q4llZInllJiEclmQqUUUxPjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)