UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q41KWvLrMcPiHjx10Mdb2R3FpGPb+JOQliPnB+Y68oQ='
WHERE
key_id = 'dd5cb782e3e33c0cdcb2ecc6509fcfa15a05fabf554065f7674c7b5d11e0c39a'
AND (
token = 'q41KWvLrMcPiHjx10Mdb2R3FpGPb+JOQliPnB+Y68oQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)