UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KG0VSVr3KRQPFP7JvehA/B77RKPqssyA6f0G9Q+LmDU='
WHERE
key_id = '9a9b269e5ca2d88ab5b2cea71bc301c15c9e907a297616beb79c03839c3b847c'
AND (
token = 'KG0VSVr3KRQPFP7JvehA/B77RKPqssyA6f0G9Q+LmDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)