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