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