UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VNhid1y+PzFSmY4/ltH+1z7w/LNZEQgXnYscTLF68+E='
WHERE
key_id = 'a4a3f0e6335f34c96d4d8589c8388bcf83ea2316e6895117f2ec36d8c7bb76a9'
AND (
token = 'VNhid1y+PzFSmY4/ltH+1z7w/LNZEQgXnYscTLF68+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)