UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Kch37+sDVEq/0DERqf4hBGYBBzNFsy4IG9YT1i+yQoE='
WHERE
key_id = 'ef090067ba9dd82e44fc544ab73def1b9acc9dbb56730fb44eec48822823bce5'
AND (
token = 'Kch37+sDVEq/0DERqf4hBGYBBzNFsy4IG9YT1i+yQoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)