UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S99DgeV0xb+Ce1bmZy6vkBCgUkQdxL3/NXIc3kZPfE8='
WHERE
key_id = '8867e7a30b03301855ef7a63fd7e4387fc8107bd0ab299a9b5d88813673c7d48'
AND (
token = 'S99DgeV0xb+Ce1bmZy6vkBCgUkQdxL3/NXIc3kZPfE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)