UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BBsE6OEAZARhEDADcLaeR4kwh2B+Svm6HPZWgiT9Gdc='
WHERE
key_id = '8c19e355f250b6c1d8036ed896b66967c1c5fe74843c483207aac95b8f5b1dfc'
AND (
token = 'BBsE6OEAZARhEDADcLaeR4kwh2B+Svm6HPZWgiT9Gdc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)