UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VYxwxR5A8gWobhlbBLuefBbcFwEDTxOvKFdUgYagRcE=' 
WHERE 
  key_id = '22af323f5611b81185bd9b2106d6caa87b5705efbb6d9954eba88943840193a4' 
  AND (
    token = 'VYxwxR5A8gWobhlbBLuefBbcFwEDTxOvKFdUgYagRcE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026