UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aMFVVNRBtp//ECjPEpveEzze250P/bH1Dzr8iz6cccw='
WHERE
key_id = 'e85f012037d851032333a2c80425816b49b0df9b0d66b6bd539dc518880ff8f9'
AND (
token = 'aMFVVNRBtp//ECjPEpveEzze250P/bH1Dzr8iz6cccw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)