UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rNsi6ChaVfldsbwr0bKPZsHemwRej/LdzYbakvpPVa4='
WHERE
key_id = 'c4a8de9fac001b3449e5ca7d08acffff32dbd45140911cc7af60421787fd3bbf'
AND (
token = 'rNsi6ChaVfldsbwr0bKPZsHemwRej/LdzYbakvpPVa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)