UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kTnY2JzxWK35NDjB6AfZHsGbftQI0ReYn+2273O5ynU='
WHERE
key_id = 'd42e949e587db2b9637a615161512cc287901ace430476542590392eb4c39a80'
AND (
token = 'kTnY2JzxWK35NDjB6AfZHsGbftQI0ReYn+2273O5ynU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)