UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rZiU34mCooWG+JjH6+ubZ+mFX/OLxJ2YrHKgy38HPYM='
WHERE
key_id = 'a8e68896b083400bdcd9fe2310f2addceec48c8445fc1eef538984ca1190cb7e'
AND (
token = 'rZiU34mCooWG+JjH6+ubZ+mFX/OLxJ2YrHKgy38HPYM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)