UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MsSBbrw5Wfl0lKpmWnNlZSSGCYxs8uWRSefDm45zndU='
WHERE
key_id = 'cd9862b589126acf2d9e366ecfdcb810dfb51d1b14905915edb71e6bfcf801de'
AND (
token = 'MsSBbrw5Wfl0lKpmWnNlZSSGCYxs8uWRSefDm45zndU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)