UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GRVV2Z2IrLpq+gtmwU1n07B8R9pVX1yhv81vP05NHhI='
WHERE
key_id = 'c3f5a44379cfc1f2545bb27f8f70d3902505312bba4bf52b65332a65e849dc15'
AND (
token = 'GRVV2Z2IrLpq+gtmwU1n07B8R9pVX1yhv81vP05NHhI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)