UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R9DPt9aX3rzxvEIRTB0u2fm6HPNwWJdiBlkpt2aqd5A='
WHERE
key_id = 'ba2a2a66c1d27db01610057b81e754cb7e804ae89de933e4233e166eaafc356e'
AND (
token = 'R9DPt9aX3rzxvEIRTB0u2fm6HPNwWJdiBlkpt2aqd5A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)