UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QiQ9B7bU08MmeXhtzvutVik3NSQVVa2Qbghe+sM3PJs='
WHERE
key_id = '40cddeac7bd045ea1bc3944853741e866e9e93fb0725ff470e7d072cc7041b49'
AND (
token = 'QiQ9B7bU08MmeXhtzvutVik3NSQVVa2Qbghe+sM3PJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)