UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WIcq2aiiI847Ym3dTB45t+4ZtBtczEQprZM/AdZ0y8w='
WHERE
key_id = '1afcb684a291ded27cadc1fa60d9c2ac41768e79d7664a53309f8493be8858f0'
AND (
token = 'WIcq2aiiI847Ym3dTB45t+4ZtBtczEQprZM/AdZ0y8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)